<?php
/**
 * Created by PhpStorm.
 * User: hongyeah
 * Date: 2015/11/18
 * Time: 18:32
 */

namespace Home\Controller;
use Think\Controller;

class SearchController extends Controller
{
    public function index(){
        $search['title'] = I('search');

        $this->assign('search',$search);
        $this->display();

    }

    public function getRouteList(){

        $title = I('get.search/s');

        $route_model = D('Route');

        try {

            $data = $route_model->getRoute($title,4);

        }catch (Exception $e){

            $this->ajaxReturn(array('state'=>'0','show'=>0));

        }

        $data->state = 1;

        $this->ajaxReturn($data);

    }

    public function getStrategyList(){

        $title = I('search/s');

        $strategy_model = D('Strategy');
        try {
            $data = $strategy_model->getStrategy($title,4);

        }catch (Exception $e){

            $this->ajaxReturn(array('state'=>'0','show'=>0));

        }
        $data->state = 1;

        $this->ajaxReturn($data);

    }

}